import request from "../utils/request";
import utils from "../utils/util.js";
export default {
	getCYQuanList(query) {
		const queryParmas = utils.addParamsToURL(query);
		return request.get(`/system/moments/list?${queryParmas}`);
	},

	/**
	 * 发布
	 * @param {*} id
	 * @returns
	 */
	addCYQuan(data) {
		return request.post("/system/moments", data);
	},

	getCYQuanDetailById(id) {
		return request.get(`/system/moments/${id}`);
	},

	/**
	 * 点赞
	 * @param {*} id
	 * @returns
	 */
	addOrDelLike(id, type) {
		return request.get(`/system/moments/like?id=${id}&type=${type}`);
	},

	/**
	 * 收藏
	 * @param {*} id
	 * @param {*} type
	 * @returns
	 */
	addOrDelCollect(id, type) {
		return request.get(`/system/moments/collect?id=${id}&type=${type}`);
	},

	/**
	 * 增加一级评论
	 * @param {*} data
	 * @returns
	 */
	addComment(data) {
		return request.post("/system/comment", data);
	},

	/**
	 * 增加二级评论
	 * @param {*} data
	 * @returns
	 */
	addSecondaryComment(data) {
		return request.post("/system/secondary", data);
	},

	/**
	 * 删除圈
	 * @param {*} id
	 * @returns
	 */
	delMomentsById(id) {
		return request.request(`/system/moments/${id}`, "DELETE");
	},

	/**
	 * 查询收藏/喜欢的宠友圈帖子
	 * @param {*} id
	 * @param {*} type 1收藏，2喜欢
	 * @returns
	 */
	queryCollectorLike(userId, type) {
		return request.get(
			`/system/moments/queryCollectorLike?userId=${userId}&type=${type}`
		);
	},

	/**
	 * 获取一级评论
	 */
	getCommentListOne(postId) {
		return request.get(`/system/comment/list?postId=${postId}`)
	},

	/**
	 * 获取二级评论
	 */
	getCommentListTwo(postCommentId) {
		return request.get(`/system/secondary/list?postCommentId=${postCommentId}`)
	},
	/**
	 * 关注 /system/fans
	 */
	addFans(data) {
		return request.post("/system/fans", data);
	},
	
	/**
	 * 取消关注/system/fans/{ids}
	 */
	delFans(ids) {
		return request.get(`/system/fans/${ids}`)
	},
};